package com.burstly.lib.component;

import android.content.Context;
import android.view.View;
import com.burstly.lib.util.LoggerExt;
import com.burstly.lib.util.Utils;
import java.util.Map;

public abstract class AbstractAdaptor
  implements IBurstlyAdaptor
{
  protected static final LoggerExt LOG = LoggerExt.getInstance();
  private static final IBurstlyAdaptorListener MOCK_LISTENER = new IBurstlyAdaptorListener()
  {
    private static final String TAG = "MOCK_LISTENER";

    public void adWasClicked(String paramAnonymousString, boolean paramAnonymousBoolean)
    {
      AbstractAdaptor.LOG.logWarning("MOCK_LISTENER", "Mock burstly adaptor listener invocation! Network: {0}. Method: adWasClicked", new Object[] { paramAnonymousString });
    }

    public void didLoad(String paramAnonymousString, boolean paramAnonymousBoolean)
    {
      AbstractAdaptor.LOG.logWarning("MOCK_LISTENER", "Mock burstly adaptor listener invocation! Network: {0}. Method: didLoad", new Object[] { paramAnonymousString });
    }

    public void dismissedFullscreen(IBurstlyAdaptorListener.FullscreenInfo paramAnonymousFullscreenInfo)
    {
      AbstractAdaptor.LOG.logWarning("MOCK_LISTENER", "Mock burstly adaptor listener invocation! Network: {0}. Method: dismissedFullscreen", new Object[] { paramAnonymousFullscreenInfo });
    }

    public void failedToLoad(String paramAnonymousString1, boolean paramAnonymousBoolean, String paramAnonymousString2)
    {
      AbstractAdaptor.LOG.logWarning("MOCK_LISTENER", "Mock burstly adaptor listener invocation! Network: {0}. Method: failedToLoad", new Object[] { paramAnonymousString1 });
    }

    public void onCollapse(String paramAnonymousString)
    {
      AbstractAdaptor.LOG.logWarning("MOCK_LISTENER", "Mock burstly adaptor listener invocation! Method: onCollapse", new Object[0]);
    }

    public void onExpand(String paramAnonymousString, boolean paramAnonymousBoolean)
    {
      LoggerExt localLoggerExt = AbstractAdaptor.LOG;
      Object[] arrayOfObject = new Object[1];
      arrayOfObject[0] = Boolean.valueOf(paramAnonymousBoolean);
      localLoggerExt.logWarning("MOCK_LISTENER", "Mock burstly adaptor listener invocation! isFullscreen: {0}. Method: onExpand", arrayOfObject);
    }

    public void onHide(String paramAnonymousString)
    {
      AbstractAdaptor.LOG.logWarning("MOCK_LISTENER", "Mock burstly adaptor listener invocation! Method: onHide", new Object[0]);
    }

    public void onShow(String paramAnonymousString)
    {
      AbstractAdaptor.LOG.logWarning("MOCK_LISTENER", "Mock burstly adaptor listener invocation! Method: onShow", new Object[0]);
    }

    public void shownFullscreen(IBurstlyAdaptorListener.FullscreenInfo paramAnonymousFullscreenInfo)
    {
      AbstractAdaptor.LOG.logWarning("MOCK_LISTENER", "Mock burstly adaptor listener invocation! Network: {0}. Method: shownFullscreen", new Object[] { paramAnonymousFullscreenInfo });
    }
  };
  private IBurstlyAdaptorListener mAdaptorListener;
  private final Context mContext;
  private Boolean mHardwareAccelerationFlag;
  private volatile boolean mIsDestroyed;
  private volatile boolean mIsStopped;
  private LayoutParametersResolver mLayoutParamsResolver;
  private Map<String, ?> mParamsFromServer;
  protected String mTag;
  private final String mViewId;

  public AbstractAdaptor(Context paramContext, String paramString)
  {
    this.mContext = paramContext;
    this.mViewId = paramString;
  }

  protected abstract void checkParameters(Map<String, ?> paramMap)
    throws IllegalArgumentException;

  public void destroy()
  {
    stop();
    this.mAdaptorListener = null;
    this.mIsDestroyed = true;
    this.mParamsFromServer = null;
    this.mLayoutParamsResolver = null;
  }

  protected abstract View doGetNewAd();

  public void endTransaction(IBurstlyAdaptor.TransactionCode paramTransactionCode)
  {
    LOG.logInfo(this.mTag, "End transaction code: {0} for adaptor {1}", new Object[] { paramTransactionCode, this });
  }

  public void endViewSession()
  {
    LOG.logDebug(this.mTag, "endViewSession() for {0}", new Object[] { this });
  }

  public IBurstlyAdaptorListener getAdaptorListener()
  {
    if (this.mAdaptorListener != null)
      return this.mAdaptorListener;
    return MOCK_LISTENER;
  }

  protected Context getContext()
  {
    return this.mContext;
  }

  protected LayoutParametersResolver getLayoutParamsResolver()
  {
    return this.mLayoutParamsResolver;
  }

  public final View getNewAd()
  {
    View localView = doGetNewAd();
    setHardwareAcceleration(localView);
    return localView;
  }

  protected Map<String, ?> getParamsFromServer()
  {
    return this.mParamsFromServer;
  }

  protected String getViewId()
  {
    return this.mViewId;
  }

  protected boolean isDestroyed()
  {
    return this.mIsDestroyed;
  }

  public boolean isStopped()
  {
    return this.mIsStopped;
  }

  public void pause()
  {
  }

  public void precacheInterstitialAd()
  {
  }

  public void resume()
  {
  }

  public void setAdaptorListener(IBurstlyAdaptorListener paramIBurstlyAdaptorListener)
  {
    this.mAdaptorListener = new AdaptorListenerWrapper(paramIBurstlyAdaptorListener);
  }

  protected void setHardwareAcceleration(View paramView)
  {
    if ((paramView != null) && (this.mHardwareAccelerationFlag != null))
    {
      LoggerExt localLoggerExt = LOG;
      String str = this.mTag;
      Object[] arrayOfObject = new Object[1];
      arrayOfObject[0] = this.mHardwareAccelerationFlag;
      localLoggerExt.logDebug(str, "Setting hardware acceleration to {0}", arrayOfObject);
      Utils.setHardwareAcceleration(paramView, this.mHardwareAccelerationFlag.booleanValue());
    }
  }

  public void showPrecachedInterstitialAd()
  {
  }

  public void startTransaction(Map<String, ?> paramMap)
    throws IllegalArgumentException
  {
    if (paramMap == null)
      throw new IllegalArgumentException("Error parsed response!");
    this.mParamsFromServer = paramMap;
    ComponentState localComponentState = (ComponentState)paramMap.get("componentState");
    Utils.checkNotNull(localComponentState, "state can not be null");
    this.mHardwareAccelerationFlag = ((Boolean)paramMap.get("OverrideHardwareAccelerationTo"));
    this.mLayoutParamsResolver = new LayoutParametersResolver(localComponentState.getFullResponse(), localComponentState.getResponseData(), this.mTag);
    this.mLayoutParamsResolver.setScale(Utils.getScale(this.mContext));
    checkParameters(paramMap);
  }

  public void startViewSession()
  {
    LOG.logDebug(this.mTag, "startViewSession() for {0}", new Object[] { this });
  }

  public void stop()
  {
    this.mIsStopped = true;
  }

  public String toString()
  {
    return getNetworkName();
  }

  public class AdaptorListenerWrapper extends BurstlyAdaptorListenerWrapper
  {
    AdaptorListenerWrapper(IBurstlyAdaptorListener arg2)
    {
      super();
    }

    public void failedToLoad(String paramString1, boolean paramBoolean, String paramString2)
    {
      super.failedToLoad(paramString1, paramBoolean, paramString2);
    }

    public void setClickRedirectUrl(String paramString)
    {
      IBurstlyAdaptorListener localIBurstlyAdaptorListener = getListener();
      if ((localIBurstlyAdaptorListener instanceof AdaptorListener))
        ((AdaptorListener)localIBurstlyAdaptorListener).setClickRedirectUrl(paramString);
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.lib.component.AbstractAdaptor
 * JD-Core Version:    0.6.2
 */